import { combineReducers } from 'redux-immutable'
import * as types from './constant'
import Immutable from 'immutable'

const initialDisplayState = Immutable.fromJS({text: 'Text to display', buffered: ''})
export function display(state = initialDisplayState, action) {
  switch (action.type) {
    case types.DISPLAY:
      return state.set('text', action.text)
    case types.BUFFER:
      return state.set('buffered', action.buffer)
    default:
      return state
  }
}

export default combineReducers({
  display
})